/*   1:    */package com.linkage.bss.commons.exception;
/*   2:    */
/*   3:    */import com.linkage.bss.commons.util.ExceptionUtil;
/*   4:    */import java.io.PrintStream;
/*   5:    */import java.io.PrintWriter;
/*   6:    */
/*  22:    */public class BssCheckedException
/*  23:    */  extends Exception
/*  24:    */{
/*  25:    */  private static final long serialVersionUID = 7698665227494141616L;
/*  26:    */  private Result result;
/*  27:    */  
/*  28:    */  public BssCheckedException(Result result, Throwable cause)
/*  29:    */  {
/*  30: 30 */    super(result.getMsg(), cause);
/*  31: 31 */    this.result = result;
/*  32:    */  }
/*  33:    */  
/*  40:    */  public BssCheckedException(int code, String msg)
/*  41:    */  {
/*  42: 42 */    super(msg);
/*  43: 43 */    this.result = new Result(code, msg);
/*  44:    */  }
/*  45:    */  
/*  53:    */  public BssCheckedException(Result result, String detail)
/*  54:    */  {
/*  55: 55 */    super(result.getMsg() + "," + detail);
/*  56: 56 */    this.result = new Result(result.getCode(), result.getMsg() + "," + detail);
/*  57:    */  }
/*  58:    */  
/*  67:    */  public BssCheckedException(Result result, String detail, Throwable cause)
/*  68:    */  {
/*  69: 69 */    super(result.getMsg() + "," + detail, cause);
/*  70: 70 */    this.result = new Result(result.getCode(), result.getMsg() + "," + detail);
/*  71:    */  }
/*  72:    */  
/*  80:    */  public BssCheckedException(int code, String msg, Throwable cause)
/*  81:    */  {
/*  82: 82 */    super(msg, cause);
/*  83: 83 */    this.result = new Result(code, msg);
/*  84:    */  }
/*  85:    */  
/*  92:    */  public BssCheckedException(int code, Throwable cause)
/*  93:    */  {
/*  94: 94 */    super(cause);
/*  95: 95 */    this.result = new Result(code, null);
/*  96:    */  }
/*  97:    */  
/* 102:    */  public String getMessage()
/* 103:    */  {
/* 104:104 */    return ExceptionUtil.buildMessage(super.getMessage(), getCause());
/* 105:    */  }
/* 106:    */  
/* 109:    */  public String toXmlString()
/* 110:    */  {
/* 111:111 */    StringBuilder sb = new StringBuilder();
/* 112:112 */    sb.append("<exception>");
/* 113:    */    
/* 114:114 */    if (getResult() != null) {
/* 115:115 */      sb.append(this.result.toString());
/* 116:    */    }
/* 117:117 */    sb.append("<exceptionTrace>");
/* 118:118 */    sb.append(getMessage());
/* 119:119 */    sb.append("</exceptionTrace>");
/* 120:    */    
/* 121:121 */    sb.append("<exception/>");
/* 122:122 */    return sb.toString();
/* 123:    */  }
/* 124:    */  
/* 125:    */  public void printStackTrace(PrintStream ps)
/* 126:    */  {
/* 127:127 */    ps.print("<exception>");
/* 128:128 */    if (getResult() != null) {
/* 129:129 */      ps.print(this.result.toString());
/* 130:    */    }
/* 131:131 */    ps.append("<exceptionTrace>");
/* 132:    */    
/* 133:133 */    Throwable cause = getCause();
/* 134:134 */    if (cause == null) {
/* 135:135 */      super.printStackTrace(ps);
/* 136:    */    } else {
/* 137:137 */      ps.println(this);
/* 138:138 */      ps.print("Caused by: ");
/* 139:139 */      cause.printStackTrace(ps);
/* 140:    */    }
/* 141:141 */    ps.append("</exceptionTrace>");
/* 142:142 */    ps.println("</exception>");
/* 143:    */  }
/* 144:    */  
/* 145:    */  public void printStackTrace(PrintWriter pw)
/* 146:    */  {
/* 147:147 */    pw.print("<exception>");
/* 148:148 */    if (getResult() != null) {
/* 149:149 */      pw.print(this.result.toString());
/* 150:    */    }
/* 151:151 */    pw.append("<exceptionTrace>");
/* 152:    */    
/* 153:153 */    Throwable cause = getCause();
/* 154:154 */    if (cause == null) {
/* 155:155 */      super.printStackTrace(pw);
/* 156:    */    } else {
/* 157:157 */      pw.println(this);
/* 158:158 */      pw.print("Caused by: ");
/* 159:159 */      cause.printStackTrace(pw);
/* 160:    */    }
/* 161:161 */    pw.append("</exceptionTrace>");
/* 162:162 */    pw.println("</exception>");
/* 163:    */  }
/* 164:    */  
/* 170:    */  public Result getResult()
/* 171:    */  {
/* 172:172 */    return this.result;
/* 173:    */  }
/* 174:    */  
/* 175:    */  public void setResult(Result result) {
/* 176:176 */    this.result = result;
/* 177:    */  }
/* 178:    */}


/* Location:           E:\workspace\sungl111\workspace_promotion\BizHallConfig\WebRoot\WEB-INF\lib\bss.commons-0.1.jar
 * Qualified Name:     com.linkage.bss.commons.exception.BssCheckedException
 * JD-Core Version:    0.7.0-SNAPSHOT-20130630
 */